<template>
  <div>
    <h1>用户信息{{ user }}</h1>
    <button @click="user.age += 1">点击年龄＋1</button>
  </div>
</template>

<script setup>
import { watch, ref } from 'vue';

let user = ref({
  name: 'zs',
  age: 15,
});
watch(
  user,
  (val) => {
    console.log(val);
  },
  { deep: true, immediate: true }
);
</script>
